﻿using MyUAMS.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UserWork_BRForm : System.Web.UI.Page
{
    WorkServer assetSrv = new WorkServer();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
        }
    }

    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["Aid"] == null)
        {
            lblProErr.Text = "发生了错误";
        }
        else
        {
            if(Session["CustomerId"] != null && Session["CustomerName"] != null)
            {
                int uid = (int)Session["CustomerId"];
                string username = Session["CustomerName"].ToString();
                int aid = int.Parse(Request.QueryString["Aid"]);
                var asset = assetSrv.GetAssetByAid(aid);
                string aname = asset.Aname;
                assetSrv.Insert_BR(aid, aname, "借出", uid, username, txtbname.Text.Trim(), int.Parse(txtbphone.Text), txtrname.Text.Trim(), int.Parse(txtrphone.Text), int.Parse(txtbamount.Text), txtremark.Text.Trim());
                Response.Redirect("AssetBR.aspx");
            }
        }
       
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("AssetBR.aspx");
    }
}